using System;
using System.ServiceModel;
using Whisper.CommonTypes;
using Whisper.CommonTypes.RequestResponse;
using Whisper.Interfaces;
using Whisper.RequestResponseMessages;

namespace Whisper.Objects
{
    public class ConversationServiceAdapter : IConversationServiceAdapter,IDisposable
    {
        private  IConversationService _service= new ChannelFactory<IConversationService>("ConversationServiceEndPoint").CreateChannel();

        public IConversationList GetAvailableConversations()
        {
         
                var conversations = _service.GetListOfConversations(new GetListOfConversationsRequest());
                return conversations.Body;
        }

        public void CreateConversationRegistration(string conversationName)
        {
      
                _service.CreateConversation(new CreateConversationRequest{ Body=conversationName});
        }

        public void Dispose()
        {
            _service = null;
        }
    }
}


